<?php include("../config.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php echo $sitename; ?> - Sysop: Manage New Submissions</title>
<meta name="description" content="<?php echo $sitename; ?> - Sysop: Manage New Submissions">
<meta name="keywords" content="free to try, software, shareware, freeware, developers, vendors, download, PAD">
<meta name="author" content="Andrey Aleksanyants, M.D.">
<meta name="copyright" content="easy HTools">
<meta http-equiv="imagetoolbar" content="no">
<link rel="stylesheet" type="text/css" href="../<?php echo $cssfile; ?>">
<link rel="shortcut icon" href="../favicon.ico">
</head>
<body>
<table class="tmain" align="center" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td class="tmain">
<table class="tlogo" align="center" width="100%" cellspacing="0" cellpadding="4">
<tr>
<td align="right">
<p><a href="index.php">Home</a></p>
</td>
</tr>
</table>
</td>
</tr><tr>
<td class="tmain">
<br>
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="1">
<tr valign="top">
<td class="tbody">
<h1><?php echo $sitename; ?> - Sysop: Manage New Submissions</h1>
<?php

// Connecting to database
if(!($link_id = mysql_connect($dbhost, $userid, $userpassword))) {
	die("<p><b>Error connecting to the database server:</b> " . mysql_error() . "</p>\n");
}
mysql_select_db($dbname);

$numrows = 0;
$result = mysql_query("SELECT * FROM submitlog ORDER BY logtime, company", $link_id);
if($result) $numrows = mysql_num_rows($result);
echo "<p>There are <b>" . $numrows . "</b> submissions pending for approval.</p><br>\n";
?>

<table class="tvisible" align="center" cellspacing="0" cellpadding="4">
<tr>
<td class="tablehead">
<p><b>No</b></p>
</td>
<td class="tablehead">
<p><b>Date added</b></p>
</td>
<td class="tablehead">
<p><b>User IP</b></p>
</td>
<td class="tablehead">
<p><b>Company</b></p>
</td>
<td class="tablehead">
<p><b>Title, Version</b></p>
</td>
<td class="tablehead">
<p><b>Download</b></p>
</td>
<td class="tablehead">
<p><b>Affiliate</b></p>
</td>
<td class="tablehead">
<p><b>Back Link URL</b></p>
</td>
<td class="tablehead">
<p><b>Accept</b></p>
</td>
<td class="tablehead">
<p><b>Decline</b></p>
</td>
</tr>
<?php
$count = 0;
for ($i=0; $i<$numrows; $i++) {
	$count++;
	mysql_data_seek($result, $i);
	$query = mysql_fetch_array($result);
	
	$submid       = $query["submid"];
	$logtime      = $query["logtime"];
	$ipaddr       = $query["ipaddr"];
	$company      = $query["company"];
	$website      = $query["website"];
	$title        = $query["title"];
	$version      = $query["version"];
	$download     = $query["download"];
	$affiliate    = $query["affiliate"];
	$affiliateid  = $query["affiliateid"];
	$homepage     = $query["homepage"];
	$backlink     = $query["backlink"];
	
	$affiliatedisp = "-";
	if($affiliate) {
		$affiliatedisp = $affiliate . ": " . $affiliateid;
	}
	$backlinkdisp = "-";
	if($backlink) {
		$backlinkdisp = "<a target=\"_blank\" href=\"" . $backlink . "\">Back Link</a>";
	}
	// Displaying code
	echo "<tr>\n<td>\n";
	echo "<p>" . $count . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p>" . $logtime . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p>" . $ipaddr . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a target=\"_blank\" href=\"" . $website . "\">" . $company . "</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a target=\"_blank\" href=\"" . $homepage . "\">" . $title . " " . $version . "</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a href=\"" . $download . "\">Download</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p>" . $affiliatedisp . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p>" . $backlinkdisp . "</p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a href=\"submprocess.php?submid=" . $submid . "&action=accept\">Accept</a></p>\n";
	echo "</td>\n<td>\n";
	echo "<p><a href=\"submprocess.php?submid=" . $submid . "&action=decline\">Decline</a></p>\n";
	echo "</td>\n</tr>\n";
}
// Disconnecting from database
mysql_close($link_id);
?>
</table><br>
<br>

</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
